<template>
  <view class="manageDevice">
    <navBar color="#000" background="#e0dac9" :title="$t('system.update')"></navBar>
    <view class="item-wrap">
      <view class="item flex_s">
        <view class="item-left">{{$t('home.Automatic-update')}}</view>
        <view class="item-right">{{autoUpdate==0?'是':'否'}}</view>
      </view>

      <view class="item flex_s">
        <view class="item-left">{{$t('home.current-version')}}</view>
        <view class="item-right">{{deviceversion}}</view>
      </view>


      <!-- <view class="item flex_s" @click="config.path('/pagesA/device/wifiNet/wifiNet')" >
				<view class="item-left">WiFi连接</view>
				<view class="item-right flex_1">
					<view>已连接</view>
					<image src="/static/image/icon-arrow.png"></image>
				</view>
			</view> -->


      <view class="item flex_s" @click="getPath">
        <view class="item-left">{{$t('home.System-update')}}</view>
        <view class="item-right flex_1">
          <view v-if="isUpdate>0" class="new-btn flex_1">{{$t('home.new-version')}}</view>
          <image src="/static/image/icon-arrow.png"></image>
        </view>
      </view>

      <!-- <view class="item flex_s" @click="handleUnbind">
				<view class="item-left">设备解绑</view>
				<view class="item-right flex_1">
					<view></view>
					<image src="/static/image/icon-arrow.png"></image>
				</view>
			</view> -->

    </view>

    <PopupInput ref="PopupInput" @confirm="handleInputConfirm" :title="title" :tips="true"></PopupInput>
    <!-- <PopupUnbind ref="PopupUnbind" @confirm="handleUnbindConfirm"></PopupUnbind> -->
  </view>
</template>

<script>
  import PopupInput from '@/componets/PopupInput.vue';
  import PopupUnbind from '@/componets/PopupUnbind.vue';
  export default {
    components: {
      PopupInput,
      PopupUnbind
    },
    data() {
      return {
        isList: true, //是否有数据			
        title: '修改设备名称',
        deviceversion: '',
        sn: '',
        autoUpdate: '',
        isUpdate: ''
      };
    },
    onLoad(e) {
      console.log(e, 'e')
      this.sn = e.sn
      this.deviceversion = e.deviceversion
      this.isUpdate = e.isUpdate
      this.autoUpdate = e.autoUpdate
    },
    methods: {
      getPath() {
        if (this.isUpdate > 0) {
          this.config.path('/pagesA/device/updateVersion/updateVersion?isUpdate=' + this.isUpdate + '&sn=' + this.sn)
        } else {
          this.config.Toast(this.$t('new.version'))
        }
      },
      handleInputConfirm() {
        // 这里添加你想要执行的代码 
        console.log('知道了');
      },
      handleUpdateName() {
        this.$refs.PopupInput.open();
      },
      // 设备解绑
      // handleUnbind(){
      // 	this.$refs.PopupUnbind.open();
      // },
      // handleUnbindConfirm() {
      // 	console.log('解绑-知道了');
      // },
    }
  }
</script>

<style lang="scss" scoped>
  .manageDevice {
    .item-wrap {
      .item {
        border-bottom: 1px solid #f5f5f5;
        padding: 25rpx 40rpx;
        background: #fff;
        color: #333333;
        font-size: 32rpx;

        .item-right {
          image {
            width: 13rpx;
            height: 22rpx;
            margin-left: 10rpx;
          }

          .new-btn {
            // width: 147rpx;
            // height: 55rpx;
            background: #FF3030;
            border-radius: 27rpx;
            font-weight: 500;
            font-size: 26rpx;
            color: #FFFFFF;
            padding: 10rpx 20rpx;
          }
        }
      }
    }
  }
</style>